<template>
    <div class="person">
       <h1>中国</h1>
       <h2 ref="tittle2">北京</h2>
       <h3>尚硅谷</h3>
       <button @click="showLog">点我输出h2这个元素</button>
    </div>
</template>

<script setup lang="ts" name = 'Person'>
    import {ref} from 'vue'

    let tittle2 = ref()

    function showLog(){
        console.log(tittle2.value);
        
    }
</script>

<style scoped>
.person {
    background-color: skyblue;
    box-shadow: 0 0 10px;
    border-radius: 10px;
    padding: 20px;
}

button {
    margin: 0 10px;
}

li{
    font-size: 20px;
}
</style>